package com.engine.devcom.mode.service.impl;

import com.engine.core.impl.Service;
import com.engine.devcom.mode.cmd.BaseRestDeleteDataByConditionCmd;
import com.engine.devcom.mode.cmd.BaseRestGetDataByConditionCmd;
import com.engine.devcom.mode.cmd.BaseRestGetDataListCmd;
import com.engine.devcom.mode.cmd.BaseRestUpdateDataByConditionCmd;
import com.engine.devcom.mode.service.BaseRestService;
import weaver.hrm.User;

import java.util.Map;

/**
 * @author : hmy
 * @since : 2025/5/6
 */
public class BaseRestServiceImpl extends Service implements BaseRestService {
    @Override
    public Map<String, Object> getDataList(String interfaceKey, Map<String, Object> params, User user) {
        return commandExecutor.execute(new BaseRestGetDataListCmd(interfaceKey, params, user));
    }

    @Override
    public Map<String, Object> getDataByCondition(String interfaceKey, Map<String, Object> params, User user) {
        return commandExecutor.execute(new BaseRestGetDataByConditionCmd(interfaceKey, params, user));
    }

    /**
     * 暂时支持单条更新
     *
     * @param interfaceKey
     * @param params
     * @return
     */
    @Override
    public Map<String, Object> modifyByCondition(String interfaceKey, Map<String, Object> params, User user) {
        return commandExecutor.execute(new BaseRestUpdateDataByConditionCmd(interfaceKey, params, user));
    }

    @Override
    public Map<String, Object> removeByCondition(String interfaceKey, Map<String, Object> params, User user) {
        return commandExecutor.execute(new BaseRestDeleteDataByConditionCmd(interfaceKey, params, user));
    }
}
